package org.wk.account.api.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.wk.account.service.ReleaseYuanService;
import org.wk.core.common.view.ResponseVo;

/**
 * 鲸源释放
 * @author df.wu
 */
@RestController
public class ReleaseYuanController {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private ReleaseYuanService releaseYuanService;

    /**
     * 获取是否需要领取红包
     * @return
     */
    @RequestMapping(value="/release_yuan",method=RequestMethod.GET,produces=MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String findAllAccount() {
        logger.info("获取当天鲸源释放鲸仔状态=====>>>{}");
        ResponseVo responseVo = releaseYuanService.selectReleaseYuan();
        logger.info("获取当天鲸源释放鲸仔状态=====>>>{}",responseVo.toString());
        return responseVo.toString();

    }

    /**
     * 领取红包
     * @return
     */
    @RequestMapping(value="/release_yuan",method=RequestMethod.POST,produces=MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String releaseYuan() {
        logger.info("领取释放鲸源红包=====>>>{}");
        ResponseVo responseVo = releaseYuanService.addReleaseYuan();
        logger.info("领取释放鲸源红包=====>>>{}",responseVo.toString());
        return responseVo.toString();

    }

}
